/**
 * 
 */
package cn.softTank.BpelModelImpl;

import org.dom4j.DocumentHelper;
import org.dom4j.Element;

import cn.softTank.BpelModel.PartnerLink;

/**
 * @author Yuzone (smartzxy@gmail.com)
 *
 */
public class PartnerLinkImpl implements PartnerLink {

	private String name;
	private String partnerLinkType;
	private String myRole;
	private String partnerRole;
	private boolean initializePartnerRole;
	private boolean isSetInitializePartnerRole=false;

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#getInitializePartnerRole()
	 */
	@Override
	public Boolean getInitializePartnerRole() {
		return this.initializePartnerRole;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#getMyRole()
	 */
	@Override
	public String getMyRole() {
		return this.myRole;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#getName()
	 */
	@Override
	public String getName() {
		return this.name;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#getPartnerLinkType()
	 */
	@Override
	public String getPartnerLinkType() {
		return this.partnerLinkType;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#getPartnerRole()
	 */
	@Override
	public String getPartnerRole() {
		return this.partnerRole;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#isSetInitializePartnerRole()
	 */
	@Override
	public boolean isSetInitializePartnerRole() {
		return this.isSetInitializePartnerRole;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#setInitializePartnerRole(java.lang.Boolean)
	 */
	@Override
	public void setInitializePartnerRole(Boolean value) {
		this.initializePartnerRole=value;
		this.isSetInitializePartnerRole=true;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#setMyRole(java.lang.String)
	 */
	@Override
	public void setMyRole(String value) {
		this.myRole=value;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#setName(java.lang.String)
	 */
	@Override
	public void setName(String value) {
		this.name=value;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#setPartnerLinkType(java.lang.String)
	 */
	@Override
	public void setPartnerLinkType(String value) {
		this.partnerLinkType=value;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#setPartnerRole(java.lang.String)
	 */
	@Override
	public void setPartnerRole(String value) {
		this.partnerRole=value;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLink#unsetInitializePartnerRole()
	 */
	@Override
	public void unsetInitializePartnerRole() {
		this.isSetInitializePartnerRole=false;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.XmlAdapt#toElement()
	 */
	@Override
	public Element toElement() {
		Element e=DocumentHelper.createElement("partnerLink");
		if(name!=null)
			e.addAttribute("name", name);
		if(partnerLinkType!=null)
			e.addAttribute("partnerLinkType", partnerLinkType);
		if(myRole!=null)
			e.addAttribute("myRole", myRole);
		if(partnerRole!=null)
			e.addAttribute("partnerRole", partnerRole);
		if(isSetInitializePartnerRole)
			if(initializePartnerRole)
				e.addAttribute("initializePartnerRole", "yes");
			else
				e.addAttribute("initializePartnerRole", "no");
		return e;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.XmlAdapt#toXml()
	 */
	@Override
	public String toXml() {
		// TODO Auto-generated method stub
		return null;
	}

}
